//
//  ByViewProductCommentListHeader.m
//  mijifen_ios
//
//  Created by 朱凯 on 2017/11/2.
//  Copyright © 2017年 itboye. All rights reserved.
//

#import "ByViewProductCommentListHeader.h"

@implementation ByViewProductCommentListHeader
{
    UILabel *_countLabel;
}
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    
    _countLabel = [[UILabel alloc] init];
    _countLabel.text = @"";
    _countLabel.font = FONT(14);
    _countLabel.textAlignment = NSTextAlignmentLeft;
    _countLabel.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:_countLabel];
    
    // 线条
    UIView *line = [UIView new];
    line.backgroundColor = BY_LINE_COLOR;
    [self.contentView addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self);
        make.height.equalTo(@1);
    }];
    
    [_countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.bottom.equalTo(@0);
    }];
}

- (void)setModel:(ByModelProductDetail *)model {
    
    _model = model;
    _countLabel.text = [NSString stringWithFormat:@"商品评价(%li条)", model.commentCount];
}

@end
